// GxConfirmEventSink.cpp : implementation file
//

#include "stdafx.h"
#include "SpeedOrder.h"
#include "GxConfirmEventSink.h"
#include "wp2_i_5.c"
#include "OrderManager.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// GxConfirmEventSink

IMPLEMENT_DYNCREATE(GxConfirmEventSink, CCmdTarget)

GxConfirmEventSink::GxConfirmEventSink()
{
	EnableAutomation();
	m_pOrderMgr = NULL;
}

GxConfirmEventSink::~GxConfirmEventSink()
{
}


void GxConfirmEventSink::OnFinalRelease()
{
	// When the last reference for an automation object is released
	// OnFinalRelease is called.  The base class will automatically
	// deletes the object.  Add additional cleanup required for your
	// object before calling the base class.
	m_Cookie = 0;
	CCmdTarget::OnFinalRelease();
}


BEGIN_MESSAGE_MAP(GxConfirmEventSink, CCmdTarget)
	//{{AFX_MSG_MAP(GxConfirmEventSink)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

BEGIN_DISPATCH_MAP(GxConfirmEventSink, CCmdTarget)
	//{{AFX_DISPATCH_MAP(GxConfirmEventSink)
	DISP_FUNCTION(GxConfirmEventSink, "OnNewConfirm", OnNewConfirm, VT_EMPTY, VTS_DISPATCH)
	//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()

// Note: we add support for IID_IGxConfirmEventSink to support typesafe binding
//  from VBA.  This IID must match the GUID that is attached to the 
//  dispinterface in the .ODL file.

// {8C509AEA-B170-4784-8188-FB6FA3FE3105}
//static const IID IID_IGxConfirmEventSink =
//{ 0x8c509aea, 0xb170, 0x4784, { 0x81, 0x88, 0xfb, 0x6f, 0xa3, 0xfe, 0x31, 0x5 } };

BEGIN_INTERFACE_MAP(GxConfirmEventSink, CCmdTarget)
	INTERFACE_PART(GxConfirmEventSink, DIID_IGxConfirmEvents, Dispatch)
END_INTERFACE_MAP()

/////////////////////////////////////////////////////////////////////////////
// GxConfirmEventSink message handlers

void GxConfirmEventSink::OnNewConfirm(LPDISPATCH a_GxConfirm) 
{
	// TODO: Add your dispatch handler code here
	if (m_pOrderMgr)
		m_pOrderMgr->OnNewConfirm(a_GxConfirm);
}
